The present disclosure relates generally to the field of database management, and more particularly to grouping data in databases. Database systems typically store data in tables that are defined using a data definition language, wherein each table has a defined set of columns, and the data is stored in the table in rows such that each column of each row contains the same kind of data. For example, a “department table” could describe each department in an enterprise with columns identifying, for example, the department manager and the department to which they report along with additional information, such as the department location.
Rows in such a table may contain information for one department. Data is typically retrieved from a database table for direct use by a user. Retrieval is typically accomplished using a query language, for example the structured query language (SQL). Within the SQL standard, the SELECT statement is typically utilized for data retrieval and limited to a choice between selecting all columns or specifying each column for which data should be retrieved. Current database data retrieval solutions utilize “views” or “materialized query tables”. A view is a kind of virtual table where the retrieved data and any required transformations are encapsulated in the definition of the view.